<?php

namespace front\modules\app\controllers;


use front\controllers\WebBaseController;
use order\services\RepairNotesService;
use Yii;
use yii\web\Controller;
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;

/**
 * RepairnotesController implements the CRUD actions for RepairNotes model.
 */
class RepairnotesController extends WebBaseController
{
    public function behaviors()
    {
        return [
            'verbs' => [
                'class' => VerbFilter::className(),
                'actions' => [
                    'create' => ['post'],
                ],
            ],
        ];
    }

    /**
     * Creates a new RefundMap model.
     * If creation is successful, the browser will be redirected to the 'view' page.
     * @return mixed
     */
//          $data = [
//              'map_id' => 1,
//              'user_id' => 1234,
//              'user_type' => 1,
//              'reason' => '因为发动机坏了',
//          ];
    public function actionCreate()
    {
        $data = Yii::$app->request->post();

        $model = new RepairNotesService();

        $result = $model->add($data);

        WebBaseController::getAjaxData(1,'获取成功', $result);
    }

    /**
     * 退单查询
     * @param data
     * @return mixed
     */
    public function actionSearch() {
        $data = Yii::$app->request->get();

        $result = RepairNotesService::search($data);

        WebBaseController::getAjaxData(1,'获取成功', $result);
    }
}
